<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/main.css" />
    <script type="text/javascript" src="../script/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="../script/api.js"></script>
    <script type="text/javascript" src="../script/mobile.js"></script>
    <script type="text/javascript" src="../script/public.js"></script>
    <script type="text/javascript" src="../script/app.js"></script>
    <title>小卖部付款</title>
</head>
<body>
<header>
    <div class="xiaomaib">
        <div>
            <img src="../image/jiant_rg.png" alt="" onclick="open_winrs('index','index.html')">
            <p>小卖部付款</p>
        </div>
    </div>
</header>
<section>
    <div class="fukuan">
        <p>付款金额</p>
        <span>
            <em>￥</em>
            <input name="sum" type="text" autofocus="autofocus">
        </span>
    </div>

    <div class="xmb_btn">
        <input type="button" value="提交" onclick="payment()">
    </div>
</section>
</body>
<script type="text/javascript">
    window['adaptive'].desinWidth = 750;
    window['adaptive'].baseFont = 28;
    window['adaptive'].maxWidth = 750;
    window['adaptive'].init();

    apiready = function () {
        $api.fixStatusBar($api.dom('.header'));
        api.addEventListener({
            name: 'keyback'
        }, function(ret, err){
            api.closeWidget();
        });


    }

    //付款
    function payment(){
        var did = api.deviceId;
        var sum = $('input[name=sum]').val();
        if (sum == '') {
            api.alert({msg:'请输入金额！'});return;
        }
        var p = {uid:id,sum:sum,did:did};
        api.ajax({
            url:webSiteUrl+'/app/Record/payment_shop',
            method:'post',
            data:{
                values: p
            }
        },function(ret,err){
            // alert(JSON.stringify(ret));
            // return;
            if(ret.code == 200){
                api.openWin({
                    name: 'zhifu',
                    url: './zhifu_cg.html',
                    reload:true,
                    pageParam: {
                        balance: ret.data.balance,
                        total:ret.data.total
                    }
                });
            }else{
                alert(ret.msg)
            }
        });
    }
</script>
</html>